%-----------------------------------------------------------------------------
\chapter{Implementation}
%-----------------------------------------------------------------------------




\section{Chosen Implementation}



\subsection{Web Speech API}
The Web Speech API specification issued on 19 October 2012 by the W3C "`defines
a JavaScript API to enable web developers to incorporate speech recognition and
synthesis into their web pages. It enables developers to use scripting to
generate text-to-speech output and to use speech recognition as an input for
forms, continuous dictation and control. The JavaScript API allows web pages to
control activation and timing and to handle results and alternatives "`
\cite{W3CWebSpeechAPI}. The specification is not a W3C Standard nor it
is in the W3C Standards Track \cite{W3CWebSpeechAPI}. However, because of the
fact that former W3C specifications have been adopted very quickly, well and
widely by the different Browser vendors it can be assumed that the Web Speech
API specification is going to be a well and widely supported standard - or at
least de facto standard - in the future too. Furthermore the specified
functionality suffices all required features: 

  \begin{enumerate}
    \item
    It supports speech recognition.
    \item
    It supports speech synthesis.
    \item
    It can be embedded into HTML web applications.
    \item
    It can be executed from Browsers.    
  \end{enumerate}


Therefore it was chosen for implementation.



\subsection{Browsers}
Since - independent of different statistical data provided by different
companies - more than two third of the global Browser market share in October
2014 belongs to the three different Browsers Chrome (provided by Google Inc.),
Internet Explorer (provided by Microsoft Inc.) and Firefox (provided by the
Mozilla Foundation) \cite{W3Counter} \cite{StatCounter}, as shown in figure
~\ref{figure1}. 


\begin{figure}[H]
    \centering
    \includegraphics [width=12.8cm,angle=0] {figures/1.png}
    \caption{Web Browser market share as of October 2014 by W3Counter.com,
    Copyright W3Counter}
    \label{figure1}
\end{figure}


Therefore these three in the given version respectively, as
shown in table ~\ref{table1}, have been chosen for implementation.

\begin{table}[htbp]
\begin{center}
\begin{tabular}{|l|l|l|} 
\hline 
Browser name 		& Vendor 	 & Version	\\ 
\hline 
\hline
Chrome 				& Google Inc. 		 	& 38		\\ 
\hline
Internet Explorer	& Microsoft Inc. 	 	& 11		\\
\hline
Firefox				& Mozilla Foundation  	& 30		\\ 
\hline
\end{tabular}
\end{center}
\caption{Used Browsers with their version respectively}
\label{table1}
\end{table}




Furthermore it is an interesting fact that Chrome's market share is increasing
for at least at year. While other Browsers market share is declining or at best
stagnating, as shown in figure ~\ref{figure2}.

\begin{figure}[htbp]
    \centering
    \includegraphics [width=11.2cm,angle=0] {figures/2.png}
    \caption{Top 5 Desktop, Tablet \& Console Browsers from Oct 2013 to Oct 2014
    by StatCounter, Copyright StatCounter}
    \label{figure2}
\end{figure}



\subsubsection{Operating systems}
As operating system Linux Mint 16 64-bit edition - except for the
Internet Explorer Browser - has been chosen. Internet Explorer has been utilized
on Microsoft Windows 7 Ultimate 64-bit edition with service pack 1 installed
because it cannot be run on Linux operating systems.




\section{Results of the implementation}


\subsection{Developed HTML applications}
Two HTML applications have been developed.
The first recognizes in natural human language spoken words and provides the
result as text inside the HTML page, as shown in figure
~\ref{figure3}. 

\begin{figure}[H]
    \centering
    \includegraphics [width=12cm,angle=0] {figures/3.jpg}
    \caption{Screenshot of speech recognition test application}
    \label{figure3}
\end{figure}


The second synthesises text provided by the user, as shown in
figure ~\ref{figure4}. Both applications either support English or German.


\begin{figure}[H]
    \centering
    \includegraphics [width=12cm,angle=0] {figures/4.jpg}
    \caption{Screenshot of speech synthesis test application}
    \label{figure4}
\end{figure}


\subsection{Web Speech API}
The Web Speech API provides all described and necessary features for utilizing 
speech recognition in the developed HTML application.

\lstinputlisting[language=Java]{figures/1.java}

Additionally it provides all described and necessary features for utilizing 
speech synthesis in the developed HTML application.

\lstinputlisting[language=Java]{figures/2.java}

Among many other useful features it provides a possibility to examine if the
current Browser supports the API and an event model including error handling
utilizing callback functions. Furthermore it supports the selection of different
languages and dialects.


\subsection{Browser support}
The evaluation revealed that only Google's Chrome Browser, version 25 or higher,
currently supports the Web Speech API specified by the W3C. Mozilla's Firefox
Browser although claiming via Javascript examination to support speech synthesis
does not. Furthermore the implementation in the Chrome Browser does not seem to
be technically stable because the Browser crashed or freezed several times
during examination without providing any error message. Especially after using
the Web Speech API for more than 15 minutes in the average.


\subsection{Speech processing in Google's Chrome Browser}
Both, speech recognition and speech synthesis, are executed on a remote server.
The Javascript API only works as a transmitter between the local installed
Browser and the remote server software that provides recognition and synthesis.
Therefore, if not connected to the network none of the features works.
Nevertheless, both functionalities respond very fast with almost no delay like
``normal surfing''.


\subsubsection{Speech recognition}
The quality of speech recognition is very high. Almost, approximately 80 to 90
percent of every spoken test input was recognized correctly. However, it is very
important do interact with the speech recognition service in ones own mother
language! And to set this with the corresponding dialect at the Web Speech API
level. Interaction with the speech recognition for example in English as non
native English speaker dropped the recognition level to approximately 30 to 40
percent.


\subsubsection{Speech synthesis}
The quality of speech synthesis is very high. Especially synthesizing
only single words. Synthesizing several sentences in a row revealed that
pausing between sentences is too short. Implied again that the set language
fits the provided text.
